<template>
  <div class="wfull">
    <a-form :labelCol="{ span: 6 }" :wrapperCol="{ span: 18 }">
      <a-form-item>
        <template slot="label">
          <ZgCheckbox v-model="obj.typeCk">流程类型</ZgCheckbox>
        </template>
        <ZgDictionary v-model="obj.type" code="flowType"></ZgDictionary>
      </a-form-item>
      <a-form-item>
        <template slot="label">
          <ZgCheckbox v-model="obj.categoryCk">流程分类</ZgCheckbox>
        </template>
        <ZgDictionary v-model="obj.category" code="flowCategory"></ZgDictionary>
      </a-form-item>
      <a-form-item>
        <template slot="label">
          <ZgCheckbox v-model="obj.nextCodeCk">后续流程编号</ZgCheckbox>
        </template>
        <ZgInput v-model="obj.nextCode"></ZgInput>
      </a-form-item>
    </a-form>
  </div>
</template>
<script>
import { dic } from './dic'
export default {
  props: {
    ids: {
      type: Array,
      default: () => {
        return []
      }
    }
  },
  data () {
    return {
      dic,
      obj: {
        typeCk: false,
        type: '',
        categoryCk: false,
        category: '',
        nextCodeCk: false,
        nextCode: '',
        id: '0'
      }
    }
  },
  methods: {
    save () {
      if (
        this.obj.typeCk === false &&
        this.obj.categoryCk === false &&
        this.obj.nextCodeCk === false &&
        true) {
        return this.$result.error('请选择要设置的属性')
      }
      if (this.obj.typeCk === true && this.obj.type.length === 0) {
        return this.$result.error('请输入流程类型')
      }
      if (this.obj.categoryCk === true && this.obj.category.length === 0) {
        return this.$result.error('请输入流程分类')
      }
      if (this.obj.nextCodeCk === true && this.obj.nextCode.length === 0) {
        return this.$result.error('请输入后续流程编号')
      }
      return this.$result.ok(Object.assign({ idList: this.ids }, this.obj))
    }
  }
}
</script>

<style lang="scss" scoped>
</style>
